package net.rock.service;

import net.rock.pojo.Category;
import net.rock.mapper.CategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryService {
    @Autowired
    private CategoryMapper categoryMapper;

    public List<Category> fetchAllCategories() {
        return categoryMapper.fetchAllCategories();
    }

    public Category fetchCategoryById(int id) {
        return categoryMapper.fetchCategoryById(id);
    }

    public void addCategory(String name) {
        categoryMapper.addCategory(name);
    }

    public void editCategory(Category category) {
        categoryMapper.editCategory(category);
    }

    public void delCategory(int id) {
        categoryMapper.delCategory(id);
    }
}
